<template>
  <div>
    <h1>演示全局指令</h1>
    <el-table
      v-cong="{ fh: 200, that: this,timer:null ,meth:'getData',pageSize:pageOb.pageSize}"
      id="tableId"
      ref="myTable"
      border
      :data="tableData"
      style="width: 800px; margin: 15vh auto 0"
    >
      <el-table-column prop="id" label="编号" align="center"> </el-table-column>
      <el-table-column prop="name" label="姓名" align="center">
      </el-table-column>
      <el-table-column prop="phone" label="手机" align="center">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      myTable: null,
      tableData: [],
      pageOb: {
        page: 1,
        pageSize: 6,
      },
    };
  },
  methods: {
    async getData() {
      let res = await axios({
        method: "get",
        url: `http://192.168.1.7:3000/api/getData?page=${this.pageOb.page}&pageSize=${this.pageOb.pageSize}`,
      });
      console.log("res:", res);
      // this.tableData = [...this.tableData,...res.data.data];
      this.tableData =res.data.data;
      console.log("this.tableData", this.tableData);
    },
  },
  async mounted() {
    await this.getData();
  },
};
</script>

<style scoped></style>
